//
//  libSuperSDK.h
//  libSuperSDK
//
//  Created by wyht－ios－dev on 15/10/13.
//  Copyright © 2015年 WYHT. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#import "SSDKPayInfo.h"
#import "SSDKDelegate.h"

@interface SuperSDK : NSObject

/**
 * 初始化SuperSDK。
 *
 * @param appId        SuperSDK分配的唯一appId
 * @param appSecret    SuperSDK分配的appSecret
 * @param privateKey   SuperSDK分配的privateKey
 * @param userDelegate 账号相关操作回调
 * @param payDelegate  支付相关操作回调
 * @param debugMode    是否开启调试日志
 */
+ (void) initWithAppId:(NSString *)appId
             appSecret:(NSString *)appSecret
            privateKey:(NSString *)privateKey
          userDelegate:(id<SSDKDelegate>)userDelegate
           payDelegate:(id<SSDKDelegate>)payDelegate
             debugMode:(BOOL) debugMode;

+ (NSString *) getVersionName;

+ (NSString *) getVersionCode;

+ (NSString *) uid;

+ (NSString *) token;

+ (NSString *) getUserDefinedValue:(NSString *)key;

/**
 * 老版登录接口，通过游戏服务器转发登录验证请求给SuperSDK。
 * 登录后选服务器
 *
 * @param loginReqUrl 游戏服务器地址。SuperSDK客户端会将登录验证的uid和token发送到该游戏服务器地址，然后游戏服务器
 *                    将请求数据转发到SuperSDK服务器，SuperSDK服务器将验证结果发送回该地址，最后游戏服务器转发
 *                    给SuperSDK客户端
 * @param data        客户端透传参数，原样传递给游戏服务器
 */
+ (void) login:(NSString *)loginReqUrl
       appData:(NSString *) data;

/**
 * 老版登录接口，通过游戏服务器转发登录验证请求给SuperSDK。
 * 登录前选服务器
 *
 * @param serverID    服务器ID，必须是大于0的整数
 * @param loginReqUrl 游戏服务器地址。SuperSDK客户端会将登录验证的uid和token发送到该游戏服务器地址，然后游戏服务器
 *                    将请求数据转发到SuperSDK服务器，SuperSDK服务器将验证结果发送回该地址，最后游戏服务器转发
 *                    给SuperSDK客户端
 * @param data        客户端透传参数，原样传递给游戏服务器
 */
+ (void) login:(int) serverID
   loginReqUrl:(NSString *)loginReqUrl
       appData:(NSString *) data;
/**
 * 新版登录接口。
 * 需要游戏方主动去supersdk服务器请求登录结果
 
 * @param data        为兼容旧接口保留，传入空字符(@"")即可
 */
+ (void) login:(NSString *) data;

+ (BOOL) isLogin;

/**
 * 支付接口(必须接入)。
 * 需要游戏方主动去supersdk服务器请求登录结果
 
 * @param payInfo      订单信息
 */
+ (void) payWithPayInfo:(SSDKPayInfo *) payInfo;

/**
 * 判断是否支持某种类型的消息
 */
+ (BOOL) isSupported:(NSString *) message;

/**
 * 发送消息给SuperSDK(比如登出，上报数据等)
 */
+ (void) call:(NSString *) message
         with:(id) obj;

/**
 * 释放SuperSDK资源。
 * 游戏退出时调用。
 */
+ (void) destory;



+ (BOOL) application:(id)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

+ (BOOL) application:(id)application handleOpenURL:(NSURL *)url;

+ (BOOL) application:(id)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options;

+ (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;

+ (void) applicationWillEnterForeground:(id)application;

+ (void) applicationDidEnterBackground:(id)application;

+ (void) applicationDidBecomeActive:(UIApplication *)application;

+ (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;

+ (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;

+ (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo;

+ (void) application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;

+ (void) application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity;

+ (void) applicationWillTerminate:(id)application;

+ (void) application:(id)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler;

+ (void) application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;

@end

